package de.fhffm.scs.simulator.regulator;

import de.fhffm.scs.simulator.data.BloodSugarLevel;

public class BasicUnitCalc implements UnitCalc {
	private int Bloodsugarvalue = 10; // bloodsugreduced per unit insuln

	public int getUnitsNeededToReduceBloodSugarLevel(BloodSugarLevel futureBSL) {

		return calculteUnitofInsuln(futureBSL);

	}

	public void setbloodysugar(int newbloodsugar) { // set amountof bloogsugar
													// reduced by one unit of
													// insuln

		Bloodsugarvalue = newbloodsugar;
	}

	// calculating the amount of insuln need to reduce Bloodsugar level to 100
	public int calculteUnitofInsuln(BloodSugarLevel futureBSL) {
		// if one unit of insuln reduces blood sugar lever by 10
		int differencebetweenbloodsugarlevel = 0;
		if (futureBSL.getLevel() > 100) {
			differencebetweenbloodsugarlevel = futureBSL.getLevel() - 100; // reduce
																			// it
																			// to
																			// 100
		}

		int i = differencebetweenbloodsugarlevel / Bloodsugarvalue;
		return i;
	}

}
